ABC277 C - Ladder Takahashi
提出
WA
code: python
n = int(input())
from collections import defaultdict
d = defaultdict(list)
# グラフ
ans = []
for i in ab:
print(1)
exit()
def dfs(de, m):
if len(de) == 0:
ans.append(m)
for i in de:
if i > m:
m = i
print(max(ans))
解答
code: python
from collections import defaultdict, deque
n = int(input())
d = defaultdict(list)
for a, b in ab:
queue = deque()
queue.append(1)
visited = {1}
while queue:
next = queue.popleft()
if not now in visited:
queue.append(now)
visited.add(now)
print(max(visited))
テーマ
メモ
提出
code: python
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
n = int(input())
d = defaultdict(list)
for a, b in ab:
ans = -1
while len(queue) > 0:
now = queue.pop(0)
continue
ans = max(ans, now)
print(ans)